package com.geqian.web.serializer;

import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.BeanProperty;
import com.fasterxml.jackson.databind.ObjectMapper;

import java.util.List;
import java.util.stream.Collectors;

/**
 * @author geqian
 * @date 20:00 2024/1/10
 */
public class ListSerializationConverter implements SerializationConverter {

    @Override
    public Object conversion(Object value, BeanProperty beanProperty, ObjectMapper objectMapper) throws JsonProcessingException {
        return ((List)value).stream().map(String::valueOf).collect(Collectors.toList());
    }

}
